home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Testing & Debugging / Virtual User Libraries & Tools / VU-Related Tools / vuCollect 1.0b1 / vuCollect < prev    next >
Encoding:
Text File  |  1992-05-05  |  3.6 KB  |  139 lines  |  [TEXT/MPS ]

  1.  
  2. #----------------------------------------------------------------------------
  3. #    
  4. #    NAME
  5. #        vuCollect -- Reformat Descriptor window information to a readable 
  6. #                     multi-line format.
  7. #
  8. #    VERSION:  1.0b1
  9. #    
  10. #    SYNOPSIS
  11. #            
  12. #        vuCollect -t "TargetName" [-d "DescriptorTrait"] 
  13. #        
  14. #    AUTHOR    K. Landreth   MS 35-BD
  15. #    
  16. #    DESCRIPTION
  17. #        vuCollect is an MPW script which calls Virtual User for the specified target,
  18. #        collects descriptor information, and then pipes that output to an MPW tool
  19. #        "vuFormatter" which in turn converts the descriptor information to a 
  20. #        multi-line format instead of the single-line format normally given by VU.
  21. #        This structured format makes the descriptor information very readable and is
  22. #        also handy for documenting various information about an application and its
  23. #        corresponding VU scripts.
  24. #
  25. #        The default descriptor trait used is "window"; however using the -d command,
  26. #        the user can specify whatever descriptor trait he/she wishes.  (e.g.:
  27. #
  28. #                    vucollect -t "*:myTarget" -d "menu" > myFile
  29. #
  30. #        would specify to output to "myFile" the menu descriptors for myTarget machine
  31. #        in a readable multi-line format.
  32. #        
  33. #        vuCollect must have "VU" and the secondary tool "vuFormatter" accessible;
  34. #        therefore you should place all three files in the MPW Tools folder or in a 
  35. #        folder which is accessible to your current working directory.
  36. #        
  37. #        vuCollect makes use of the VU menu script (if installed - see VU docs) 
  38. #        and its associated default variables for zones, targets, etc.  After
  39. #        "Pick Target" is selected from VU menu, you could simply type:
  40. #
  41. #                            vucollect
  42. #
  43. #        vuFormatter will output window descriptors with additional information
  44. #        about descriptors' sizes and relative location within each window.
  45. #        See 'ReadMe' file.
  46. #    
  47. #    HISTORY    06/26/90    - Created.
  48. #            08/22/90    - Take out output file option.
  49. #                        - vu optional output to "vuCollectTemp"
  50. #                        - Redirect vu Err/output to "Dev:Null".
  51. #            08/24/90    - Added support for VU menu and default variables.
  52. #                        - Delete need for one temporary file.
  53. #            02/20/91    - Allow for single quotes in chooser name.
  54. #
  55. #    COPYRIGHT
  56. #          Copyright Apple Computer, Inc. 1990
  57. #            All rights reserved.
  58. #    
  59. #-----------------------------------------------------------------------------
  60.  
  61.  
  62.  
  63. set cmd            "{0}"
  64. set desTypeFlag    0
  65. set desTypeOpt    0
  66. set desType        "window"
  67. set targetFlag    0
  68. set targetOpt    0
  69. set vuArgs        ""
  70. set usage        '# Usage: vuCollect -t TargetName ∂[-d DescriptorSpec∂].'
  71.  
  72.  
  73. # process parameters
  74. for Parm in {"Parameters"}
  75.     if {targetFlag}
  76.         if "{Parm}" =~ /-≈/
  77.             echo "# -t option used without target name."
  78.             echo {usage}
  79.             exit 1
  80.         else 
  81.             set targetFlag 0
  82.             set targetOpt 1
  83.             set vuArgs "{vuArgs} -t ∂"{Parm}∂""
  84.         end
  85.  
  86.     else if {desTypeFlag}
  87.         if "{Parm}" =~ /-≈/    
  88.             echo "# -d option used without Descriptor type."
  89.             echo {usage}
  90.             exit 1
  91.         else 
  92.             set desTypeFlag 0
  93.             set desTypeOpt    1
  94.             set desType "{Parm}"
  95.         end
  96.         
  97.     else if "{Parm}" =~ /-t/
  98.         set targetFlag 1
  99.     
  100.     else if "{Parm}" =~ /-d/
  101.         set desTypeFlag 1
  102.         
  103.     else if "{Parm}" =~ /-≈/
  104.         echo "# invalid option ∂'{Parm}∂'."
  105.         echo {usage}
  106.         exit 1
  107.     end
  108. end
  109.  
  110.  
  111. if {desTypeFlag}
  112.     echo "# -d option used without Descriptor type."
  113.     echo {usage}
  114.     exit 1
  115.  
  116. else if {targetFlag}
  117.     echo "# -t option used without target name."
  118.     echo {usage}
  119.     exit 1
  120.     
  121. else if !{targetOpt}
  122.     if "{VUTargetName}" == ""
  123.         echo "# -t option required to specify target."
  124.         echo {usage}
  125.         exit 1
  126.     else 
  127.         set vuArgs "{vuArgs} -t '{VUTargetZone}:{VUTargetName}'"
  128.     end
  129. end
  130.  
  131.         
  132. echo "println collect[{desType}];" | vu {vuArgs} -o vuCollectTemp > "Dev:Null" 
  133.  
  134.  
  135. vuFormatter vuCollectTemp
  136.  
  137. delete -y vuCollectTemp
  138.  
  139.